feat: add harness engineering improvements#35929
feat: add harness engineering improvements#35929tudorpopams wants to merge 20 commits intomicrosoft:masterfrom
Conversation
📊 Bundle size report✅ No changes found |
|
Pull request demo site: URL |
b4ca5af to
eefc38b
Compare
79776c7 to
3354ce6
Compare
BreckoD
left a comment
There was a problem hiding this comment.
After resolving previous comments, it should be gtg. It's interesting whether the agents will be able to track all docs and rules described, but there's only one way to figure it out =)
3354ce6 to
1bf68b7
Compare
9de8418 to
8132a03
Compare
… skills Adds five agentic workflows (.md + compiled .lock.yml): - agent-triage: classifies, labels, and validates incoming issues - agent-fix: implements bug fixes and opens PRs (triggered by agent:fix label) - agent-review: devil's advocate review with confidence scoring for agent PRs - agent-docs-grooming: weekly documentation audit - agent-skills-improvement: weekly analysis of agent PRs to improve instructions Also includes gh-aw init scaffolding (agentic-workflows agent, .gitattributes). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merges global agent context (from .github/copilot-instructions.md) into AGENTS.md alongside the existing Nx guidelines. CLAUDE.md is a symlink to AGENTS.md so both Claude Code and Copilot read the same instructions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Applies progressive disclosure, mechanical enforcement, and feedback loop patterns from OpenAI's harness engineering approach. 1. Progressive disclosure: Slim down copilot.instructions.md (473→50 lines) and AGENTS.md into pointer-only maps. Detailed docs moved to docs/: - docs/architecture/component-patterns.md (v9 hooks, slots, Griffel) - docs/architecture/design-tokens.md (token categories and usage) - docs/architecture/layers.md (package dependency tiers) - docs/workflows/contributing.md (PR checklist, commands) - docs/workflows/testing.md (test types, SSR safety) - docs/team-routing.md (teams, labels, CODEOWNERS) 2. Agent-guiding error messages: Updated all custom ESLint rules to include doc URLs and fix instructions in error messages so agents self-correct. 3. New ESLint rule: @fluentui/no-hardcoded-style-values — flags hardcoded colors and spacing in .styles.ts files, requiring design tokens. 4. Structural validation: check-v9-structure.js validates that component packages follow the canonical file structure. 5. Layer boundary validation: check-layer-boundaries.js validates that component packages (Tier 3) don't depend on other component packages. 6. Quality tracking: docs/quality-grades.md and docs/tech-debt-tracker.md for agents and engineers to track package quality and debt. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removes no-hardcoded-style-values ESLint rule, check-layer-boundaries.js, and check-v9-structure.js as requested. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Applies findings from "Increasing AI coding success to 99%" article:
- Add "instructions are source of truth, not existing code" as first line
- Add critical rules as negative constraints ("Never X") in always-loaded context
- Add concrete v9 component code template to override training defaults
- Add legacy anti-patterns section warning about v8 code agents will find
- Add exploration guidance for the large monorepo
- Reframe positive guidance as negative constraints for higher compliance
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove all GitHub Agentic Workflow files (.github/workflows/agent-*, .github/agents/, .github/aw/) and clean up related references in AGENTS.md, docs, .prettierignore, and .gitattributes. This PR now focuses solely on harness engineering improvements. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add 5 slash command skills under .claude/skills/: - /v9-component — scaffold a new v9 component with all required files - /change — create beachball change files from current diff - /lint-check — run lint, parse errors, and auto-fix common issues - /token-lookup — map hardcoded CSS values to design tokens - /package-info — quick package lookup (path, deps, owner, tests) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add 6 skills under .agents/skills/ with thin .claude/skills/ wrappers: - /v9-component — scaffold a new v9 component - /change — create beachball change files - /lint-check — run lint and auto-fix common issues - /token-lookup — map hardcoded CSS values to design tokens - /package-info — quick package lookup - /visual-test — visually verify components via Storybook + playwright-cli Replace all npx references with yarn across docs, skills, and copilot instructions to match the repo's package manager. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add /review-pr skill that reviews PRs across 8 categories: change file, V9 patterns, dependency layers, SSR safety, testing, API surface, accessibility, and security/quality. Produces a structured report with a 0-100 confidence score and APPROVE/REQUEST_CHANGES/COMMENT recommendation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- v9-component: use react-component and react-library generators instead of manually creating files, add generators reference table - change: use `yarn change` (repo's beachball script) and `yarn check:change` for verification - package-info: add useful commands section with Nx executors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use `yarn nx run react-<component>:start` instead of stories package - Handle dynamic Storybook port instead of hardcoding 6006 - Fix story ID pattern to `components-<component>--<story>` - Use port-based cleanup instead of `kill %1` Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@latest resolves to an unstable alpha version that doesn't exist on npm. 0.1.1 is the stable version that works with global install. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8c5be65 to
e1529ef
Compare
|
|
||
| 1. **Never hardcode colors, spacing, or typography values.** Always use design tokens from `@fluentui/react-theme`. See [docs/architecture/design-tokens.md](docs/architecture/design-tokens.md). | ||
| 2. **Never use `React.FC`.** Always use `ForwardRefComponent` with `React.forwardRef`. | ||
| 3. **Never access `window`, `document`, or `navigator` without SSR guards.** Use `canUseDOM()` from `@fluentui/react-utilities`. |
There was a problem hiding this comment.
maybe we should mention the targetDocument somewhere here, we usually do not use window / document directly, only via targetDocument / targetDocument.defaultView:
const { targetDocument } = useFluent_unstable();
const targetWindow = targetDocument?.defaultView;
...
targetWindow.innerWidth| 1. **Identify changed packages** by running: | ||
|
|
||
| ```bash | ||
| git diff --name-only HEAD~1 | ||
| ``` |
There was a problem hiding this comment.
I think this step is redundant, because if we will run yarn change or yarn check:change it should already report packages that need change files
…/fluentui-css-variants chore/headless-css-variants $+ +706 -16 ❯❯❯ y change check v1.0.0 v22.18.0
yarn run v1.23.34
$ beachball change --no-commit check
Checking for changes against "upstream/master"
fetching latest from remotes "upstream/master"
Found changes in the following packages:
@fluentui/react-storybook-addon-export-to-sandbox
fetching latest from remotes "upstream/master"| ## Rules | ||
|
|
||
| - Every published package change MUST have a change file | ||
| - Do not create change files for unpublished packages (stories packages, internal tools) |
There was a problem hiding this comment.
Is there a scenario when agent can manually create the change file bypassing yarn change command? Beachball automatically excludes private packages, so I guess we do not need that rule
- Add targetDocument/useFluent_unstable guidance for SSR-safe DOM access - Remove redundant package identification step from change skill (beachball auto-detects affected packages) - Simplify change skill rules: always use yarn change, never create change files manually Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Implement harness engineering best practices for AI agent instructions in the Fluent UI repo.
AGENTS.mdas a concise map, detailed docs indocs/CLAUDE.mdsymlinked toAGENTS.mdfor cross-tool compatibility.agents/skills/with thin.claude/skills/wrappersnpxreferences toyarnacross docs, skills, and copilot instructions to match the repo's package managerWhat's included
Harness Engineering (docs/ restructure)
AGENTS.mdslimmed to ~60 lines as a pointer-only map.github/instructions/copilot.instructions.mdreduced from 473 to ~50 linesdocs/architecture/component-patterns.md— v9 hooks, slots, Griffeldocs/architecture/design-tokens.md— token categories and usagedocs/architecture/layers.md— package dependency tiersdocs/workflows/contributing.md— PR checklist and commandsdocs/workflows/testing.md— test types and SSR safetydocs/team-routing.md— teams, labels, CODEOWNERSdocs/quality-grades.md— per-package quality trackingdocs/tech-debt-tracker.md— known debt items for agentsAgent Skills (
.agents/skills/+.claude/skills/)Skills live in
.agents/skills/(tool-agnostic source of truth). Claude Code wrappers in.claude/skills/reference them via@relative path — nosymlinks, Windows-compatible.
v9-component/v9-component Namechange/changelint-check/lint-check [pkg]token-lookup/token-lookup valpackage-info/package-info pkgvisual-test/visual-test Namereview-pr/review-pr #123ESLint Error Message Improvements
Updated 5 existing rules (
ban-context-export,ban-instanceof-html-element,no-global-react,no-restricted-imports,no-context-default-value) toinclude fix instructions and
docs/references in error messages.npx → yarn
All command references in docs, skills, and copilot instructions updated from
npxtoyarnto match the repo's package manager.Test plan
CLAUDE.mdsymlink resolves correctly toAGENTS.md/menu in Claude Code/package-info react-buttonreturns correct package details/token-lookup #0078d4suggests the right design token/visual-test Buttonlaunches Storybook and captures a screenshot/review-prproduces structured output with confidence score